/*
package com.ruige.account.config;

import com.ruige.account.util.CookieUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Slf4j
public class HttpServletRequestCrossFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        log.info("\n\n" +
                "****************************************************************\n" +
                "******************   HttpServletRequestCrossFilter   ***********\n" +
                "****************************************************************\n");

        Cookie accessToken = CookieUtils.getCookieByName(request, "Authorization");
        log.info("cookie:{}", accessToken);
        String token = accessToken.getValue();
        log.info("token:{}", token);
        HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(request) {
            @Override
            public String getHeader(String name) {
                    // 先从原本的Request中获取头，如果为空且名字为token，则从参数中查找并返回
                    String superHeader = super.getHeader(name);
                    if ("Authorization".equals(name) && StringUtils.isEmpty(superHeader)) {
                        String token = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJhcHAiXSwibmFtZSI6Iuedv-aIiCIsImlkIjoiMSIsImV4cCI6MTU5MzE3OTAzMiwiYXV0aG9yaXRpZXMiOlsic2Vja2lsbF9saXN0Iiwic2FsZXNtYW4iLCJnb29kc19saXN0IiwiYWNjb3VudGFudCIsInVzZXIiXSwianRpIjoiMzVjOTVkYWQtZjNlMy00MDNjLThmOTAtYzQyZWY4MTYwZjE2IiwiY2xpZW50X2lkIjoicnVpZ2VibG9nIiwidXNlcm5hbWUiOiJydWlnZSJ9.XN_hjN_Ii005lxewmvRLKkVYZHPG5LBnYcPhUO_kyIm91HvPjRVF6nsbelGK65nQb2JvJPiB051vQ8uiIvk0FIlWct3GnEJlVW8ZAZlO8tYMzf0SGpB9BRQM-ZjS5c3wmHtLrHohbbOWoVHwsqDSJ-okAJauGgonKermafcuAb4mwvqBJDv6GiZc3Pdjf1tP6NwCLRWW5TF8YOe_mJ5BUgT02tpRvYbrSKesIz3xO-TcUMkf7h_BSbQWj0o60DHB7ixhLN3zIR_CCaJ8Q1ezT8G9tSdckP_pw75n2l1lQAhG_Yt6njzkidJmnvYE3LQ_VmXiJUujX0rqJ-bbPrExNA";
//                    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken());
                        return token;
                    }
                    return superHeader;

            }
        };

        //把自定义的request传入过滤器链，进入下一个过滤器
        filterChain.doFilter(requestWrapper, response);
    }
}


*/
